/*
 * @Description: 元数据维护
 * @Version: 0.1
 * @Autor: Civet
 * @Date: 2019-10-14 10:38:41
 * @LastEditors: Civet
 * @LastEditTime: 2019-11-01 09:43:49
 */

import https from "../http";
import qs from "qs";
const WSB_API = process.env.NODE_ENV == "development" ? "/wsbUrl" : `${process.env.JZT_API}`;
const JZT_API = process.env.NODE_ENV == "development" ? "/jztUrl" : `${process.env.JZT_API}`;

const metadatamaintenanceApi = {
  // 获取目录树
  findResourceCatalog: function (query) {
    return https({
      url: `${WSB_API}/catalog/findResourceCatalog`,
      method: 'get',
      headers: {
        sendKey: "findResourceCatalog"
      },
      params: query
    })
  },
  // 获取全部体统
  findAllSysForMaintain: function (query) {
    return https({
      url: `${JZT_API}/MetaDataRegister/findAllSysForMaintain`,
      method: 'get',
      headers: {
        sendKey: "findAllSysForMaintain"
      },
      params: query
    })
  },
  // 根据系统id获取数据库列表
  findDbBySystemId: function (query) {
    return https({
      url: `${JZT_API}/MetaDataRegister/findDbBySystemId`,
      method: 'get',
      headers: {
        sendKey: "findDbBySystemId"
      },
      params: query
    })
  },
  // 根据系统id获取文件列表
  findAllFileBySystemId: function (query) {
    return https({
      url: `${JZT_API}/MetaDataRegister/findAllFileBySystemId`,
      method: 'get',
      headers: {
        sendKey: "findAllFileBySystemId"
      },
      params: query
    })
  },
  // 根据系统id获取接口列表
  findAllInterfaceBySystemId: function (query) {
    return https({
      url: `${JZT_API}/MetaDataRegister/findAllInterfaceBySystemId`,
      method: 'get',
      headers: {
        sendKey: "findAllInterfaceBySystemId"
      },
      params: query
    })
  },
  // 根据表类型id获取维护列表
  findTabBytableTypeIdForMaintain: function (query) {
    return https({
      url: `${JZT_API}/MetaDataRegister/findTabBytableTypeIdForMaintain`,
      method: 'get',
      headers: {
        sendKey: "findTabBytableTypeIdForMaintain"
      },
      params: query
    })
  },
  // 编辑数据库基本信息
  UpdateSql: function (query) {
    return https({
      url: `${JZT_API}/MetaDataRegisterSystem/UpdateSql`,
      method: 'post',
      headers: {
        sendKey: "UpdateSql"
      },
      data: query
    })
  },
  // 编辑系统基本信息
  UpdateSystem: function (query) {
    return https({
      url: `${JZT_API}/MetaDataRegisterSystem/UpdateSystem`,
      method: 'post',
      headers: {
        sendKey: "UpdateSystem"
      },
      data: query
    })
  },
  // 根据系统id获取系统信息
  findSys: function (query) {
    return https({
      url: `${JZT_API}/MetaDataRegister/findSys`,
      method: 'get',
      headers: {
        sendKey: "findSys"
      },
      params: query
    })
  },
  // 根据数据库id获取数据库信息
  findSql: function (query) {
    return https({
      url: `${JZT_API}/MetaDataRegister/findSql`,
      method: 'get',
      headers: {
        sendKey: "findSql"
      },
      params: query
    })
  },
  updateFindOfSystem: function (query) {
    return https({
      url: `${JZT_API}/MetaDataRegister/updateFindOfSystem`,
      method: 'get',
      headers: {
        sendKey: "updateFindOfSystem"
      },
      params: query
    })
  }
};



export default metadatamaintenanceApi;
